"use strict"

/**
 * 海淀区基金爬虫
 *  
 */

var Base = require("./base");
var hdq_spider = new Base();
hdq_spider.name = "海淀区委员会";
// hdq_spider.contentType = "text";

hdq_spider.getPageUrl = function(pg) {
    var url = "http://hdqw.bjhd.gov.cn/qwyw/tzgg/index.htm"
    if(pg != 1){
        url = "http://hdqw.bjhd.gov.cn/qwyw/tzgg/index_" + (pg - 1)+".htm";
    }
    return url;
};

hdq_spider.getItems = function($) {
    var items = [];
    $(".secList li a").each(function(index, ele) {
        var e = $(ele);
        var item = {};
        item.title = e.attr("title");
        item.url = "http://hdqw.bjhd.gov.cn/qwyw/tzgg" + e.attr("href").substring(1);
        item.source = hdq_spider.name;
        items.push(item);
    });
    return items;
};

exports = module.exports = hdq_spider;